package servlet;

public class CalculateBean {
    public boolean calculate(Computer computer){
        if(computer.getOperator().equals("+")) {
            computer.setResult(computer.getFirstNumber() + computer.getSecondNumber());
            return true;
        }
        else if(computer.getOperator().equals("-")){
            computer.setResult(computer.getFirstNumber()-computer.getSecondNumber());
            return true;
        }
        else if(computer.getOperator().equals("*")){
            computer.setResult(computer.getFirstNumber()*computer.getSecondNumber());
            return true;
        }
        else if(computer.getOperator().equals("/")){
            computer.setResult(computer.getFirstNumber()/computer.getSecondNumber());
            return true;
        }
        return false;
    }
}
